import * as SupplierApi from '@/api/supplier'

export default {
  getSupplierList () {
    return new Promise(resolve => {
      SupplierApi.all().then(res => {
        resolve(res.data.list)
      })
    })
  },
  getListFromScreen () {
    return new Promise(resolve => {
      this.getSupplierList().then(res => {
        res.unshift({ sid: 0, name: '全部供应商' })
        resolve(res)
      }).catch(() => {
        resolve([{ sid: 0, name: '全部供应商' }])
      })
    })
  }
}
